<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>生成方案管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
	$(document).ready(function() {
		layui.use(['laypage', 'form','table'], function(){
			var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
			form.render();
			var laypage = layui.laypage;
			laypage.render({elem:'pageDiv',
				count: ${page.count}, //数据总数，从服务端得到
				curr:${page.pageNo},
				limit:30,
				layout: ['prev', 'page', 'next', 'count'],
				jump: function(obj, first){
				//obj包含了当前分页的所有参数，比如：
				 // console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
				 // console.log(obj.limit); //得到每页显示的条数
				
				//首次不执行
					if(!first){
						$("#firstPage").val(false);
						page(obj.curr,obj.limit);
					}
				}
			});
			var table = layui.table;
			table.init('schemeTable',{limit:30});
		});
	});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<ul class="layui-tab-title">
		<li class="layui-this"><a href="${ctx}/gen/genScheme/">生成方案列表</a></li>
		<shiro:hasPermission name="gen:genScheme:edit"><li><a href="${ctx}/gen/genScheme/form">生成方案添加</a></li></shiro:hasPermission>
	</ul></div>
	<form:form id="searchForm" modelAttribute="genScheme" action="${ctx}/gen/genScheme/" method="post" class="layui-form">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<blockquote class="layui-elem-quote quoteBox">
			<div class="layui-inline">
				<label class="layui-form-label">方案名称 ：</label>
				<div class="layui-input-block">
					<form:input path="name" htmlEscape="false" maxlength="50" class="layui-input"/>
				</div>
			</div>
			<div class="layui-inline">
				&nbsp;<input id="btnSubmit" class="layui-btn search_btn" type="submit" value="查询"/>
			</div>
		</blockquote>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="layui-table" lay-filter="schemeTable">
		<thead><tr>
			<th lay-data="{field:'name', minWidth:100}">方案名称</th>
			<th lay-data="{field:'makePart', minWidth:150}">生成模块</th>
			<th lay-data="{field:'partName', minWidth:150}">模块名</th>
			<th lay-data="{field:'featureName', minWidth:100}">功能名</th>
			<th lay-data="{field:'writer', minWidth:100}">功能作者</th>
			<shiro:hasPermission name="gen:genScheme:edit">
			<th lay-data="{field:'flag', minWidth:110, fixed:'right'}">操作</th>
			</shiro:hasPermission>
		</tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="genScheme">
			<tr>
				<td><a class="layui-blue"
				 href="${ctx}/gen/genScheme/form?id=${genScheme.id}">${genScheme.name}</a></td>
				<td>${genScheme.packageName}</td>
				<td>${genScheme.moduleName}${not empty genScheme.subModuleName?'.':''}${genScheme.subModuleName}</td>
				<td>${genScheme.functionName}</td>
				<td>${genScheme.functionAuthor}</td>
				<shiro:hasPermission name="gen:genScheme:edit"><td>
    				<a class="layui-btn layui-btn-xs" lay-event="edit" href="${ctx}/gen/genScheme/form?id=${genScheme.id}">修改</a>
					<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" href="${ctx}/gen/genScheme/delete?id=${genScheme.id}" onclick="return confirmx('确认要删除该生成方案吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div id="pageDiv" class="pagination layui-elem-field layui-field-title">${page}</div>
</body>
</html>
